import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    wsClient: {
      isConnect: false,
      wsUrl: null,
      ws: null,
      clientRecord: [],
      text1: null,
      text2: null,
      text3: null
    },
    wsServer: {
      isOpen: false,
      port: null,
      serverRecord: [],
      text1: null,
      text2: null,
      text3: null
    }
  },
  mutations: {
    changeClient (state, wsClient) {
      state.wsClient = wsClient
    },
    changeServer (state, wsServer) {
      state.wsServer = wsServer
    },
    pushServerRecord (state, message) {
      state.wsServer.serverRecord.push(message)
    }
  },
  actions: {},
  modules: {}
})
